import React from 'react';

// 老版本react 16.8.3前
// 新版本react 16.8.3  新语法react hooks
// react 18.x

// 拥抱原生
// all in js
class App extends React.Component {

  // readonly
  state = {
    count: 0,
    msg: 'hello world',
  };

  onAdd () {
    this.setState({
      count: this.state.count + 1,
    });
  }

  // 渲染
  render () {
    // jsx语法
    return (
      <div>
        { this.state.count }
        <button onClick={ this.onAdd.bind(this) }>+1</button>
      </div>
    );
  }

}

export default App;
